<!DOCTYPE html>
<!-- saved from url=(0063)http://techbrood.com/threejs/docs/api/core/BufferAttribute.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		
		<!--<base href="../../">--><base href=".">
		<script src="./list.js(1).下载"></script>
		<script src="./page.js.下载"></script>
		<link type="text/css" rel="stylesheet" href="./page.css">
	<link href="./prettify.css" rel="stylesheet"><link href="./threejs.css" rel="stylesheet"><script src="./prettify.js.下载"></script></head>
	<body>
		<h1>缓存属性（BufferAttribute）</h1>

		<div class="desc">
		这个类保存了和 <a href="javascript:window.parent.goTo(&#39;缓存几何模型(BufferGeometry)&#39;)" title="缓存几何模型(BufferGeometry)">缓存几何模型(BufferGeometry)</a> 关联的属性数据。该类用来保存内置属性比如顶点位置、法相量和颜色等，也可以被用于保存自定义属性。
		</div>

		<h2>构造器（Constructor）</h2>
		<h3>BufferAttribute( <a href="javascript:window.parent.goTo(&#39;TypedArray&#39;)" title="TypedArray">array</a>, <a href="javascript:window.parent.goTo(&#39;Integer&#39;)" title="Integer">itemSize</a>, <a href="javascript:window.parent.goTo(&#39;Boolean&#39;)" title="Boolean">normalized</a> )</h3>
		<div>
		从相关缓存中的数据来实例化这个属性。
		itemSize 给定缓存中和1个顶点关联的数组中数据的个数。normalized 表示如何将相关的缓冲区中的数据映射到GLSL着色器中代码的值。 
		</div>

		<h2>属性（Properties）</h2>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.array&#39;)" target="_parent" title="BufferAttribute.array" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;TypedArray&#39;)" title="TypedArray" id="array">array</a> </h3>
		<div>
		用来保存和这个属性关联的数据。应该有 <code class=" prettyprint"><span class="pln">itemSize </span><span class="pun">*</span><span class="pln"> numVertices</span></code> 个元素，这里 numVertices 是相关联的<a href="javascript:window.parent.goTo(&#39;缓存几何模型(BufferGeometry)&#39;)" title="缓存几何模型(BufferGeometry)">缓存几何模型(BufferGeometry)</a>的顶点个数。<a href="javascript:window.parent.goTo(&#39;TypedArray&#39;)" title="TypedArray">array</a> 可以是 UInt8Array, Int8Array, UInt16Array, Int16Array, 或 Float32Array的实例。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.itemSize&#39;)" target="_parent" title="BufferAttribute.itemSize" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;Integer&#39;)" title="Integer" id="itemSize">itemSize</a> </h3>
		<div>
		记录一个顶点和多少数组项关联。比如，如果这个属性用来保存3维向量（比如坐标、法向量或颜色），那么 itemSize 应该是3。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.length&#39;)" target="_parent" title="BufferAttribute.length" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;Integer&#39;)" title="Integer" id="length">length</a> </h3>
		<div>
		数组元素的总数目。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.needsUpdate&#39;)" target="_parent" title="BufferAttribute.needsUpdate" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;Boolean&#39;)" title="Boolean" id="needsUpdate">needsUpdate</a> </h3>
		<div>
		标识该属性是否被改变并应该重新提交给GPU。当你修改数组数据时，应设置该属性为true。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.normalized&#39;)" target="_parent" title="BufferAttribute.normalized" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;Boolean&#39;)" title="Boolean" id="normalized">normalized</a> </h3>
		<div>
		标识如何将关联的缓冲区中的数据映射到GLSL代码中的值，也就是是否正规化。比如，如果 <a href="javascript:window.parent.goTo(&#39;TypedArray&#39;)" title="TypedArray">array</a> 是UInt16Array的一个实例，<br>
        并且 <a href="javascript:window.parent.goTo(&#39;Boolean&#39;)" title="Boolean">normalized</a> 为true，那么数组数据中的 0 - +65535 取值将被映射为GLSL属性中的 0.0f - +1.0f。<br>
        而一个Int16Array（有符号的）将把 -32767 - +32767 映射到 -1.0f - +1.0f。<br>
        如果 <a href="javascript:window.parent.goTo(&#39;Boolean&#39;)" title="Boolean">normalized</a> 为 false，那么这些值将被转换成相等的浮点数，也就是 32767 会映射成 32767.0f。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.version&#39;)" target="_parent" title="BufferAttribute.version" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;Integer&#39;)" title="Integer" id="version">version</a> </h3>
		<div>
		版本号，但needsupdate属性设置为true时递增。
		</div>


		<h2>方法（Methods）</h2>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.copyAt&#39;)" target="_parent" title="BufferAttribute.copyAt" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="copyAt">copyAt</a>  ( <a href="javascript:window.parent.goTo(&#39;Integer&#39;)" title="Integer">index1</a>, attribute, <a href="javascript:window.parent.goTo(&#39;Integer&#39;)" title="Integer">index2</a> ) </h3>
		<div>
		拷贝数组中itemSize个数值，从index2处的顶点（vertex）到index1处的顶点（vertex）。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.set&#39;)" target="_parent" title="BufferAttribute.set" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="set">set</a>  ( <a href="javascript:window.parent.goTo(&#39;Array&#39;)" title="Array">value</a> ) </h3>
		<div>
		从传递的数组中取值来设置关联数组。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.setX&#39;)" target="_parent" title="BufferAttribute.setX" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="setX">setX</a> ( index, x ) </h3>
		<div>
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize</span></code>的值为 x。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.setY&#39;)" target="_parent" title="BufferAttribute.setY" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="setY">setY</a> ( index, y ) </h3>
		<div>
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">1</span></code>的值为 y。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.setZ&#39;)" target="_parent" title="BufferAttribute.setZ" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="setZ">setZ</a> ( index, z ) </h3>
		<div>
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">2</span></code>的值为 z。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.setXY&#39;)" target="_parent" title="BufferAttribute.setXY" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="setXY">setXY</a> ( index, x, y ) </h3>
		<div>
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize</span></code>的值为 x，并且
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">1</span></code>的值为 y。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.setXYZ&#39;)" target="_parent" title="BufferAttribute.setXYZ" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="setXYZ">setXYZ</a> ( index, x, y, z ) </h3>
		<div>
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize</span></code>的值为 x，且
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">1</span></code>的值为 y，且
        设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">2</span></code>的值为 z。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.setXYZW&#39;)" target="_parent" title="BufferAttribute.setXYZW" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;null&#39;)" title="null" id="setXYZW">setXYZW</a> ( index, x, y, z, w ) </h3>
		<div>
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize</span></code>的值为 x，且
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">1</span></code>的值为 y，且
        设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">2</span></code>的值为 z，且
		设置数组位于<code class=" prettyprint"><span class="pln">index </span><span class="pun">*</span><span class="pln"> itemSize </span><span class="pun">+</span><span class="pln"> </span><span class="lit">3</span></code>的值为 w。
		</div>

		<h3><a href="javascript:window.parent.goTo(&#39;BufferAttribute.clone&#39;)" target="_parent" title="BufferAttribute.clone" class="permalink">#</a> .<a href="javascript:window.parent.goTo(&#39;BufferAttribute&#39;)" title="BufferAttribute" id="clone">clone</a> () </h3>
		<div>
		拷贝属性。
		</div>

		<h2>源代码</h2>

		<a href="https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js" target="_blank">src/core/BufferAttribute.js</a>
	

</body></html>